<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    /*创建对象的三种方法：
    1.字面量创建{描述对象}
    2.构造函数创建对象：第一部定义函数，第二步实例化对象
    3.new Object()
    */
//    console.log(Math.PI);
//    console.log(Math.max(1,45,78,1236,-4556,0,99,-1111));
//    console.log(Math.ceil(Math.random())*34);
//    let randomNum=Math.random();
//    console.log(randomNum);
   function getRondomInt(min,max){
    min=Math.ceil(min);
    max=Math.floor(max);
    return Math.floor(Math.random()*(max-min+1))+min;
   }
   let randomInt=getRondomInt(1,20);
   console.log(randomInt);
   console.log('---------');
   let studentNames=["hh","ll","ss","zz","ww"];
   function randomName(){
    let randomIndex=Math.floor(Math.random()*studentNames.length);
    let selectedName=studentNames[randomIndex];
    console.log("本次被点到的同学是："+selectedName);
   }

    randomName();
    console.log('---------');
    function cai(min,max){
        return Math.floor(Math.random()*(max-min+1)+min);
    }
    let boom=cai(1,10);
    let num;
    while(true){
        num=prompt('输入你猜的值：');
        if(num===boom){
            alert('你踩雷了!');
            break;
        }else if(num>boom){
            alert('你猜大了');
        }else{
            alert('你猜小了');
        }
    }
</script>
</html>